<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"
%><%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"
%><%@ taglib prefix="security" uri="http://www.springframework.org/security/tags"
%><%@ taglib prefix="spring" uri="http://www.springframework.org/tags"
%><%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"
%><%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"
%>
<head>
    <title><fmt:message key="user" /></title>
</head>
<body>
    <h1><fmt:message key="user" /></h1>
    <c:url var="updateUrl" value="/domain/user/update.action"/>
    <form:form action="${updateUrl}" id="userForm" modelAttribute="userForm" >
        <form:errors cssClass="error"/>
        <table>
            <form:hidden path="user.inode"/>
            <tbody>
                <tr>
                    <th><fmt:message key="user_loginName" /></th>
                    <td>
                        <form:input path="user.loginName"/>
                        <script type="text/javascript">
                            Spring.addDecoration(new Spring.ElementDecoration({
                                elementId : "user.loginName",
                                widgetType : "dijit.form.ValidationTextBox",
                                widgetAttrs : {
                                    required : false
                                }
                            }));
                        </script>
                        <form:errors cssClass="error" path="user.loginName"/>
                    </td>
                </tr>
                <tr>
                    <th><fmt:message key="user_firstName" /></th>
                    <td>
                        <form:input path="user.firstName"/>
                        <script type="text/javascript">
                            Spring.addDecoration(new Spring.ElementDecoration({
                                elementId : "user.firstName",
                                widgetType : "dijit.form.ValidationTextBox",
                                widgetAttrs : {
                                    required : false
                                }
                            }));
                        </script>
                        <form:errors cssClass="error" path="user.firstName"/>
                    </td>
                </tr>
                <tr>
                    <th><fmt:message key="user_active" /></th>
                    <td>
                        <form:checkbox id="user.active" path="user.active"/>
                        <script type="text/javascript">
                            Spring.addDecoration(new Spring.ElementDecoration({
                                elementId : "user.active",
                                widgetType : "dijit.form.CheckBox",
                                widgetAttrs : {
                                    checked: ${userForm.user.active != null ? userForm.user.active : false}
                                }
                            }));
                        </script>
                        <form:errors cssClass="error" path="user.active"/>
                    </td>
                </tr>
                <tr>
                    <th><fmt:message key="user_nickName" /></th>
                    <td>
                        <form:input path="user.nickName"/>
                        <script type="text/javascript">
                            Spring.addDecoration(new Spring.ElementDecoration({
                                elementId : "user.nickName",
                                widgetType : "dijit.form.ValidationTextBox",
                                widgetAttrs : {
                                    required : false
                                    ,regExp : "[-+]?[0-9]+(\.[0-9]+)?"
                                }
                            }));
                        </script>
                        <form:errors cssClass="error" path="user.nickName"/>
                    </td>
                </tr>
                <tr>
                    <th><fmt:message key="user_email" /></th>
                    <td>
                        <form:input path="user.email"/>
                        <script type="text/javascript">
                            Spring.addDecoration(new Spring.ElementDecoration({
                                elementId : "user.email",
                                widgetType : "dijit.form.ValidationTextBox",
                                widgetAttrs : {
                                    required : false
                                }
                            }));
                        </script>
                        <form:errors cssClass="error" path="user.email"/>
                    </td>
                </tr>

                <tr>
                    <th><fmt:message key="user_birthDay" /></th>
                    <td>
                        <form:input path="user.birthDay"/>
                        <script type="text/javascript">
                            Spring.addDecoration(new Spring.ElementDecoration({
                                elementId : "user.birthDay",
                                widgetType : "dijit.form.DateTextBox",
                                widgetAttrs : {
                                    required : false,
									datePattern: 'yyyy-MM-dd'
                                }
                            }));
                        </script>
                        <form:errors cssClass="error" path="user.birthDay"/>
                    </td>
                </tr>
                <tr>
                    <th><fmt:message key="user_smsId" /></th>
                    <td>
                        <form:input path="user.smsId" />
                        <script type="text/javascript">
                            Spring.addDecoration(new Spring.ElementDecoration({
                                elementId : "user.smsId",
                                widgetType : "dijit.form.ValidationTextBox",
                                widgetAttrs : {
                                    required : false
                                }
                            }));
                        </script>
                        <form:errors cssClass="error" path="user.smsId"/>
                    </td>
                </tr>
                <tr>
                    <th><fmt:message key="user_aimId" /></th>
                    <td>
                        <form:input id="user.aimId" path="user.aimId"/>
                        <script type="text/javascript">
                            Spring.addDecoration(new Spring.ElementDecoration({
                                elementId : "user.aimId",
                                widgetType : "dijit.form.ValidationTextBox",
                                widgetAttrs : {
                                    required : false
                                }
                            }));
                        </script>
                        <form:errors cssClass="error" path="user.aimId"/>
                    </td>
                </tr>
                <tr>
                    <th><fmt:message key="user_msnId" /></th>
                    <td>
                        <form:input path="user.msnId"/>
                        <script type="text/javascript">
                            Spring.addDecoration(new Spring.ElementDecoration({
                                elementId : "user.msnId",
                                widgetType : "dijit.form.ValidationTextBox",
                                widgetAttrs : {
                                    required : false
                                }
                            }));
                        </script>
                        <form:errors cssClass="error" path="user.msnId"/>
                    </td>
                </tr>
            </tbody>
            <tfoot>
                <tr>
                    <td colspan="2">
                        <div class="buttons">
                            <button id="updateButton" type="submit"><fmt:message key="label.form.submit"/></button>
                            <script type="text/javascript">
                                Spring.addDecoration(new Spring.ValidateAllDecoration({
                                    elementId:'updateButton',
                                    event:'onclick'
                                }));
                            </script>
                            <c:url var="showUrl" value="/domain/user/show.action">
                                <c:param name="user.inode" value="${userForm.user.inode}"/>
                            </c:url>
                            <a href="${showUrl}"><span><fmt:message key="label.link.show"/></span></a>
                        </div>
                    </td>
                </tr>
            </tfoot>
        </table>
    </form:form>
</body>
